﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace FluentStateObserver.Test
{
    /// <summary>
    /// Helpers for creating some basic Mock Observables.
    /// </summary>
    public static class TestObservables
    {

        /// <summary>
        /// Builds a Series of elements in the following order [ 1, 2, 3, 4, 5 ]
        /// </summary>
        /// <returns>An Observable series of elements in the following order [ 1, 2, 3, 4, 5 ]</returns>
        internal static TestObservable SeriesObservable()
        {
            var result = new TestObservable();
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 2", 
                    TypeOfElement = ElementType.TestType2
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 3", 
                    TypeOfElement = ElementType.TestType3 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 4", 
                    TypeOfElement = ElementType.TestType4 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 5", 
                    TypeOfElement = ElementType.TestType5 
                }));

            return result;
        }

        /// <summary>
        /// Builds a Series of elements in the following order [ 1, 1, 1, 1, 1 ]
        /// </summary>
        /// <returns>An Observable series of elements in the following order [ 1, 1, 1, 1, 1 ]</returns>
        internal static TestObservable RepeatsObservable()
        {
            var result = new TestObservable();
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1",
                    TypeOfElement = ElementType.TestType1
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1 
                }));

            return result;
        }

        /// <summary>
        /// Builds a Series of elements in the following order [ 1, 2, 2, 3, 1, 2, 3, 4 ]
        /// </summary>
        /// <returns>An Observable series of elements in the following order [ 1, 2, 2, 3, 1, 2, 3, 4 ]</returns>
        internal static TestObservable BasicObservable()
        {
            var result = new TestObservable();
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1 
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 2", 
                    TypeOfElement = ElementType.TestType2
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 2", 
                    TypeOfElement = ElementType.TestType2
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 3", 
                    TypeOfElement = ElementType.TestType3 
                }));
              result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 1", 
                    TypeOfElement = ElementType.TestType1
                }));
             result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 2", 
                    TypeOfElement = ElementType.TestType2
                }));
            result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 3", 
                    TypeOfElement = ElementType.TestType3
                }));
             result.AddBlock(new GenericObservableBlock<TestElement>(
                new TestElement() 
                { 
                    Message = "Message 4", 
                    TypeOfElement = ElementType.TestType4
                }));
            return result;
        }
    }
}
